package com.example.JcGQS.pojo.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @ClassName Goods
 * @Description 物料表
 *
 *  @author 末日
 * @date 2023/11/21
 */
@Data
//@Accessors(chain = true) //测试链式set赋值
@AllArgsConstructor //全参构造
@NoArgsConstructor //无参构造
//
//@Document(indexName = "Goods")//ES中索引
public class Goods implements Serializable {

    /**
     * 物料id
     */
   // @Id
    @TableId(value = "goods_id", type = IdType.AUTO)
    private Integer goodsId;

    /**
     * 物料编号
     */
    @TableField(value = "goods_number")
    private String goodsNumber;
    /**
     * 物品id
     */
    @TableField("category_id")
    private Integer categoryId;

    /**
     * 物料名称
     */
//    @Field(type = FieldType.Text,
//            analyzer = "ik_max_word",
//            searchAnalyzer = "ik_max_word") //分词器
    @TableField("goods_name")
    private String goodsName;

    /**
     * 物料规格
     */
   // @Field(type = FieldType.Keyword)
    @TableField("goods_specification")
    private String goodsSpecification;

    /**
     * 物料型号
     */
   // @Field(type = FieldType.Keyword)
    @TableField("goods_model")
    private String goodsModel;

    /**
     * 物料单位
     */
   // @Field(type = FieldType.Keyword,index = false)//不会创建索引库//不支持搜索
    @TableField("goods_unit")
    private String goodsUnit;

    /**
     * 品牌
     */
    @TableField(value = "brand")
    private String brand;
    /**
     * 数据创建时间
     */
    @TableField(value = "goods_create_time", fill = FieldFill.INSERT)

    private LocalDateTime dataCreateTime;

    /**
     * 数据更新时间
     */
    @TableField(value = "goods_update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime dataUpdateTime;

    public Goods(Integer goodsId, String goodsNumber, Integer categoryId, String goodsName, String goodsSpecification, String goodsModel, String goodsUnit,String brand) {
        this.goodsId = goodsId;
        this.goodsNumber = goodsNumber;
        this.categoryId = categoryId;
        this.goodsName = goodsName;
        this.goodsSpecification = goodsSpecification;
        this.goodsModel = goodsModel;
        this.goodsUnit = goodsUnit;
        this.brand = brand;
    }
}
